/**
 * @Author     :lanbery
 * @e-mail     : lanbery@gmail.com
 * @version    : V1.0
 * @createtime : 2011-12-2-上午11:50:06
 */
package com.lambor.example.biz.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.lambor.example.biz.IExampleBiz;
import com.lambor.example.entity.Example;
import com.lambor.example.mapper.ExampleMapper;


/**
 * @about this class :
 * @author           ： lanbery
 * @e-mail           : lanbery@gmail.com
 * @version          : V1.0
 * @modifytime       : 2011-12-2-上午11:50:06
 * @filepath         : SSI-com.lambor.example.biz.impl//ExampleBizImpl.java
 *
 */
@Service
public class ExampleBizImpl<T extends Example> implements IExampleBiz<T> {

	@Inject
	private ExampleMapper<Example> mapper;
	
	/* (non-Javadoc)
	 * @see com.lambor.example.biz.IExampleBiz#add(com.lambor.example.entity.Example)
	 */
	public Example add(Example entity) throws DataAccessException {
		mapper.add(entity);
		return entity;
	}

	/* (non-Javadoc)
	 * @see com.lambor.example.biz.IExampleBiz#delete(com.lambor.example.entity.Example)
	 */
	public boolean delete(Example entity) throws DataAccessException {
		boolean bFlag = false;
		try{
			mapper.remove(entity);
			bFlag = true;
		}catch(DataAccessException dae){
			throw dae;
		}
		return bFlag;
	}

	/* (non-Javadoc)
	 * @see com.lambor.example.biz.IExampleBiz#edit(com.lambor.example.entity.Example)
	 */
	public boolean edit(Example entity) throws DataAccessException {
		boolean bFlag = false;
		try{
			mapper.edit(entity);
			bFlag = true;
		}catch(DataAccessException dae){
			throw dae;
		}
		return bFlag;
	}

	/* (non-Javadoc)
	 * @see com.lambor.example.biz.IExampleBiz#queryList(com.lambor.example.entity.Example)
	 */
	public List<Example> queryList(Example entity) throws DataAccessException {
		List<Example> rs = null;
		rs = mapper.queryList(entity);
		return rs;
	}
}
